<?php
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Mauthentic extends MY_Model
{
    public function __construct()
    {
        parent::__construct();
    }
    
    
    public function loginAdmin()
    {
        $uname = $this->getParamString('username');
        $upass = $this->getParamString('password');
        $pass_encode = md5(md5($uname).md5($upass));
        
        $sql = $this->db->query("SELECT id,username,fullname,mobile,level FROM admin WHERE username = '".$uname."' AND pword = '".$pass_encode."' ");
        if($sql->num_rows() > 0)
        {
            $data = $sql->row();
            $data = array(
                'admin_id'        => $data->id,
                'username'       => $data->username,
                'fullname'       => $data->fullname,
                'level'       => $data->level
            );
            $this->session->set_userdata($data);
            return '200';
        }
        return '202';
    }
}